<?
require_once LIBS."ReversedProxy.class.php";

function kindle_handler($url) {
	$client = new ReversedProxy($url);
	$client->setopt(RVSPOPT_TEXT_FORCE_CHARSET,"utf-8");
	$client->setopt(RVSPOPT_HTML_REMOVE_STYLE,true);
	$client->setopt(RVSPOPT_HTML_REMOVE_FLASH,true);
	$client->setopt(RVSPOPT_HTML_REWRITE_HYPERLINK,true);
	$client->exec_proxy();
}


function ios_handler($url,$user_agent) {
	$client = new ReversedProxy($url);
	$client->setopt(RVSPOPT_HTML_REWRITE_HYPERLINK,true);
	$client->setopt(RVSPOPT_USERAGENT,$user_agent);
	//$client->setopt(RVSPOPT_HTML_REWRITE_RESOURCEPATH,true);
	$client->exec_proxy();
}

function iphone_handler($url) {
	return ios_handler($url,"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");
}


function ipad_handler($url) {
	return ios_handler($url,"Mozilla/5.0 (iPad; U; CPU OS OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10");
}
